//
//  AppDef.swift
//  SpinCut
//
//  Created by dai simon on 2024/7/6.
//

import UIKit

let ScreenSize = UIScreen.main.bounds.size
let ScreenWidth = UIScreen.main.bounds.size.width
let ScreenHeight = UIScreen.main.bounds.size.height

let isIphoneX = isNotchScreen()
let ScreenStatusBarHeight : CGFloat = isIphoneX ? 44 : 20
let ScreenTabBarHeight : CGFloat = isIphoneX ? 83 : 49
let ScreenTabBarSafeBottomMargin : CGFloat = isIphoneX ? 34 : 0
let ScreenLandscapeTabBarSafeBottomMargin : CGFloat = isIphoneX ? 21 : 0
let ScreenNavigationBarHeight : CGFloat = isIphoneX ? 88 : 64
let KNavBarHeight = UIApplication.shared.statusBarFrame.size.height+UINavigationController.init().navigationBar.frame.size.height
let kStatusBarHeight : CGFloat = UIApplication.shared.statusBarFrame.size.height

func isNotchScreen() -> Bool {
    if UIDevice.current.userInterfaceIdiom == .pad {
        return false
    }
    var isNotchScreen = ScreenHeight >= 812
    if #available(iOS 11.0, *) {
        if let window = UIApplication.shared.windows.first {
            isNotchScreen = window.safeAreaInsets.bottom > 0
        }
    }
    return isNotchScreen
}
